Skip to content

Conversation

@SergeiPavlov
Copy link
Contributor

@SergeiPavlov SergeiPavlov commented Jun 23, 2021

Following benchmarks show the improvement:

Old Session constructor:

|             Method |     Mean |    Error |   StdDev |      Min |      Max |  Gen 0 |  Gen 1 | Gen 2 | Allocated |
|------------------- |---------:|---------:|---------:|---------:|---------:|-------:|-------:|------:|----------:|
| SessionConstructor | 44.32 us | 0.251 us | 0.210 us | 43.86 us | 44.63 us | 0.3000 | 0.1000 |     - |     47 KB |

New Session constructor:

|             Method |     Mean |    Error |   StdDev |      Min |      Max | Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------- |---------:|---------:|---------:|---------:|---------:|------:|------:|------:|----------:|
| SessionConstructor | 11.98 us | 0.127 us | 0.119 us | 11.79 us | 12.21 us |     - |     - |     - |     12 KB |

SergeiPavlov and others added 3 commits June 22, 2021 19:37
…trations

Dont use LINQ in ServiceRegistration

Don't use LINQ .ToArray() in AttributeHelper.GetAttributes()

precompute typeof() in static

Optimize ServiceContainer.Create()

Optimization: Memoize TypeHelper.GetConstructor()

Remove automatically inserted `using System.Diagnostics.CodeAnalysis`

Simple formatting

private specifier

Refactoring

User .SequenceEqual()  in TYpesComparer

Refactor TypesCompares.GetHashCode()

Rename TypesEqualityComparer

typeofIServiceContainer

Optimization: cache ServiceRegistration[] in DomainTypeRegistry

public -> private

Small optimizations: avoid LINQ in critical places

Revert to SequenceEqual in TypesEqualityComparer.Equals()

Remove comment

reorder public/private methods
@SergeiPavlov SergeiPavlov changed the title Format source code as preparation to changes; update copyright comments Optimized Session constructor Jun 23, 2021
@alex-kulakov alex-kulakov self-requested a review June 24, 2021 07:16
@alex-kulakov
Copy link
Contributor

Please DO NOT reformat files that has no actual changes except formatting, save reviewer's time and keep him concentrated on the actual changes and do not waste time

@SergeiPavlov
Copy link
Contributor Author

Please DO NOT reformat files that has no actual changes except formatting, save reviewer's time and keep him concentrated on the actual changes and do not waste time

I have intentionally split the changes into a few commits:

  • Commit 1: only reformatting without any code changes.
  • Next commits: functional changes.

@alex-kulakov
Copy link
Contributor

So I can skip first commit. I'm not really used to it, I tent to apply formatting afterwards when everything is complete :)

Copy link
Contributor

@alex-kulakov alex-kulakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also something's wrong with the FieldInfo.cs, its diff is not shown.

@SergeiPavlov
Copy link
Contributor Author

So I can skip first commit. I'm not really used to it, I tent to apply formatting afterwards when everything is complete :)

It would be very difficult to apply changes from our repo (where we reformatted the files) into the Upstream repo with unformatted files. That is why such an order of commits.

@SergeiPavlov
Copy link
Contributor Author

Also something's wrong with the FieldInfo.cs, its diff is not shown.

240ec6a#diff-b7b42eda53f702c01675e3d80d6583077c167b05e3c723803c24b1250b8c5985L447

@alex-kulakov alex-kulakov merged commit b904270 into DataObjects-NET:master Jun 28, 2021
@SergeiPavlov SergeiPavlov deleted the OptimizeSessionConstructor branch June 28, 2021 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants